package com.duyj.server.order.controller;

import com.duyj.client.order.feign.OrderFeignService;
import com.duyj.client.order.model.Order;
import com.duyj.server.order.service.OrderService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class OrderController implements OrderFeignService {

    Logger logger = LoggerFactory.getLogger(OrderController.class);

    @Autowired
    private OrderService orderService;

    @GetMapping("/getOrder")
    public Order getOrder(Long id) {
        logger.info("id:"+id);
        return orderService.getOrder(id);
    }

    @Override
    public void postOrder(Order order) {
        logger.info("order:"+order);
        orderService.postOrder(order);
    }

}
